package com.gulimall.authserver.dto;

import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@Data
public class RegisterDto {

    @Length(min = 6, max = 11, message = "用户名长度太短，6-11位")
    @NotNull(message = "用户名不能为空")
    private String username;

    @Length(min = 6, max = 11, message = "密码长度太短，6-11位")
    @NotNull(message = "密码不能为空")
    private String password;

    @Pattern(regexp = "^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\\d{8}$", message = "手机号不正确")
    private String phone;

    @NotNull(message = "验证码不能为空")
    private String code;
}
